<!-- 查询报表 -->
<ion-header *ngIf="typeData.report"  class="nav-header">
  <ion-toolbar>
    <ion-buttons slot="start">
      <ion-button (click)="toUnSettlement()">
        <ion-icon class="md-arrow-back"  ios="md-arrow-back"></ion-icon>
      </ion-button>
    </ion-buttons>
    <ion-title>报表查询</ion-title>
    <ion-buttons *ngIf="isThird" slot="end" (click)="openPicker()">
        <ion-icon class="iconfont  ion-ios-shaixuan" style="font-size: 14px; color:#fff; margin-right: 4px;"></ion-icon>
        <ion-button class="withdraw-right toolbar-white" style="font-size: 14px;" size="small"> 
          {{selectName}}
        </ion-button>
      </ion-buttons>
  </ion-toolbar>
</ion-header>
<ion-header *ngIf="typeData.report">
  <div class="report-header report-grid">
    <ion-grid>
      <ion-row>
        <ion-col size=6>
          <div class="time-select">
          <ion-datetime pickerFormat="YYYY-M-D" display-format="YYYY-MM-DD" min="{{minValue}}" cancelText="取消"
            doneText="确认" [(ngModel)]="startData"></ion-datetime><i class="iconfont calendar  ion-ios-iconset0209"
            style="font-size: 14px"></i>
          </div>
        </ion-col>
        <ion-col size=6>
          <div class="time-select" style="justify-content: center;">{{endData}}</div>
        </ion-col>
      </ion-row>
    </ion-grid>
    <div style="padding: 10px 30px;">
      <ion-button (click)="onSearch()" shape="round" size="small" expand="block">查询</ion-button>
    </div>
  </div>
</ion-header>
<ion-content *ngIf="typeData.report && selectPlatformID=='1'" style="--background: #efefef;">
  <ion-grid class="report-list">
    <ion-row>
      <ion-col size="3">日期</ion-col>
      <ion-col size="3">下注数量</ion-col>
      <ion-col size="3">有效金额</ion-col>
      <ion-col size="3">输赢金额</ion-col>
    </ion-row>
    <ion-row *ngFor="let item of thirdList" (click)="toReportThirdlist(item)">
      <ion-col size="3">{{item.report_date}}</ion-col>
      <ion-col size="3" style="color: #459df5;">{{item.num}}</ion-col>
      <ion-col size="3">{{item.bets | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(item.payouts | isnegative),'red':item.payouts | isnegative}">{{item.payouts | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-content>
<ion-footer *ngIf="typeData.report  && selectPlatformID=='1'">
  <ion-grid class="report-total">
    <ion-row>
      <ion-col size="3">总计</ion-col>
      <ion-col size="3" style="color: #459df5;">注数({{thirdListSum.cnt}})</ion-col>
      <ion-col size="3">{{thirdListSum.cash | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(thirdListSum.result | isnegative),'red':thirdListSum.result | isnegative}">{{thirdListSum.result | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-footer>
<ion-content *ngIf="typeData.report && selectPlatformID=='sbo'" style="--background: #efefef;">
  <ion-grid class="report-list">
    <ion-row>
      <ion-col size="3">日期</ion-col>
      <ion-col size="3">下注金额</ion-col>
      <ion-col size="3">有效金额</ion-col>
      <ion-col size="3">输赢金额</ion-col>
    </ion-row>
    <ion-row *ngFor="let item of thirdSBOList" (click)="toReportThirdSBOlist(item)">
      <ion-col size="3">{{item.report_date}}</ion-col>
      <ion-col size="3">{{item.bets | decimal}}</ion-col>
      <ion-col size="3">{{item.valid_amounts | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(item.payouts | isnegative),'red':item.payouts | isnegative}">{{item.payouts | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-content>
<ion-footer *ngIf="typeData.report  && selectPlatformID=='sbo'">
  <ion-grid class="report-total">
    <ion-row>
      <ion-col size="3">总计</ion-col>
      <ion-col size="3" style="color: #459df5;">注数({{thirdSBOListSum.cnt}})</ion-col>
      <ion-col size="3">{{thirdSBOListSum.cash | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(thirdSBOListSum.result | isnegative),'red':thirdSBOListSum.result | isnegative}">{{thirdSBOListSum.result | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-footer>
<ion-content *ngIf="typeData.report && selectPlatformID=='ky'" style="--background: #efefef;">
  <ion-grid class="report-list">
    <ion-row>
      <ion-col size="3">日期</ion-col>
      <ion-col size="3">下注金额</ion-col>
      <ion-col size="3">有效金额</ion-col>
      <ion-col size="3">输赢金额</ion-col>
    </ion-row>
    <ion-row *ngFor="let item of thirdKYList" (click)="toReportThirdKYlist(item)">
      <ion-col size="3">{{item.report_date}}</ion-col>
      <ion-col size="3">{{item.bets | decimal}}</ion-col>
      <ion-col size="3">{{item.valid_amounts | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(item.payouts | isnegative),'red':item.payouts | isnegative}">{{item.payouts | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-content>
<ion-footer *ngIf="typeData.report  && selectPlatformID=='ky'">
  <ion-grid class="report-total">
    <ion-row>
      <ion-col size="3">总计</ion-col>
      <ion-col size="3" style="color: #459df5;">注数({{thirdKYListSum.cnt}})</ion-col>
      <ion-col size="3">{{thirdKYListSum.cash | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(thirdKYListSum.result | isnegative),'red':thirdKYListSum.result | isnegative}">{{thirdKYListSum.result | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-footer>
<ion-content *ngIf="typeData.report && selectPlatformID=='sw'" style="--background: #efefef;">
  <ion-grid class="report-list">
    <ion-row>
      <ion-col size="3">日期</ion-col>
      <ion-col size="3">下注金额</ion-col>
      <ion-col size="3">有效金额</ion-col>
      <ion-col size="3">输赢金额</ion-col>
    </ion-row>
    <ion-row *ngFor="let item of thirdSWList" (click)="toReportThirdSWlist(item)">
      <ion-col size="3">{{item.report_date}}</ion-col>
      <ion-col size="3">{{item.bets | decimal}}</ion-col>
      <ion-col size="3">{{item.valid_amounts | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(item.payouts | isnegative),'red':item.payouts | isnegative}">{{item.payouts | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-content>
<ion-footer *ngIf="typeData.report  && selectPlatformID=='sw'">
  <ion-grid class="report-total">
    <ion-row>
      <ion-col size="3">总计</ion-col>
      <ion-col size="3" style="color: #459df5;">注数({{thirdSWListSum.cnt}})</ion-col>
      <ion-col size="3">{{thirdSWListSum.cash | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(thirdSWListSum.result | isnegative),'red':thirdSWListSum.result | isnegative}">{{thirdSWListSum.result | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-footer>
<ion-content *ngIf="typeData.report && selectPlatformID=='-1'" style="--background: #efefef;">
  <ion-grid class="report-list">
    <ion-row>
      <ion-col size="3">日期</ion-col>
      <ion-col size="3"> 注数</ion-col>
      <ion-col size="3">下注金额</ion-col>
      <ion-col size="3">盈亏</ion-col>
    </ion-row>
    <ion-row *ngFor="let item of list" (click)="toReportlist(item.date)">
      <ion-col size="3">{{item.date}}</ion-col>
      <ion-col size="3" style="color: #459df5;">{{item.cnt}}</ion-col>
      <ion-col size="3">{{item.cashsum | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(item.resultsum | isnegative),'red':item.resultsum | isnegative}">{{item.resultsum | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-content>
<ion-footer *ngIf="typeData.report  && selectPlatformID=='-1'">
  <ion-grid class="report-total">
    <ion-row>
      <ion-col size="3">总计</ion-col>
      <ion-col size="3" style="color: #459df5;">{{sum.cnt}}</ion-col>
      <ion-col size="3">{{sum.cash | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(sum.result | isnegative),'red':sum.result | isnegative}">{{sum.result | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-footer>
<ion-content *ngIf="typeData.report && selectPlatformID=='sg'" style="--background: #efefef;">
  <ion-grid class="report-list">
    <ion-row>
      <ion-col size="3">日期</ion-col>
      <ion-col size="3"> 注数</ion-col>
      <ion-col size="3">下注金额</ion-col>
      <ion-col size="3">盈亏</ion-col>
    </ion-row>
    <ion-row *ngFor="let item of thirdSGList" (click)="toReportThirdSGlist(item)">
      <ion-col size="3">{{item.report_date}}</ion-col>
      <ion-col size="3" style="color: #459df5;">{{item.num}}</ion-col>
      <ion-col size="3">{{item.bets | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(item.payouts | isnegative),'red':item.payouts | isnegative}">{{item.payouts | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-content>
<ion-footer *ngIf="typeData.report  && selectPlatformID=='sg'">
  <ion-grid class="report-total">
    <ion-row>
      <ion-col size="3">总计</ion-col>
      <ion-col size="3" style="color: #459df5;">{{thirdPSListSum.cnt}}</ion-col>
      <ion-col size="3">{{thirdPSListSum.cash | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(thirdPSListSum.result | isnegative),'red':thirdPSListSum.result | isnegative}">{{thirdPSListSum.result | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-footer>
<ion-content *ngIf="typeData.report && selectPlatformID=='ps'" style="--background: #efefef;">
  <ion-grid class="report-list">
    <ion-row>
      <ion-col size="3">日期</ion-col>
      <ion-col size="3"> 注数</ion-col>
      <ion-col size="3">下注金额</ion-col>
      <ion-col size="3">盈亏</ion-col>
    </ion-row>
    <ion-row *ngFor="let item of thirdPSList" (click)="toReportThirdPSlist(item)">
      <ion-col size="3">{{item.report_date}}</ion-col>
      <ion-col size="3" style="color: #459df5;">{{item.num}}</ion-col>
      <ion-col size="3">{{item.bets | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(item.payouts | isnegative),'red':item.payouts | isnegative}">{{item.payouts | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-content>
<ion-footer *ngIf="typeData.report  && selectPlatformID=='ps'">
  <ion-grid class="report-total">
    <ion-row>
      <ion-col size="3">总计</ion-col>
      <ion-col size="3" style="color: #459df5;">{{thirdSGListSum.cnt}}</ion-col>
      <ion-col size="3">{{thirdSGListSum.cash | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(thirdSGListSum.result | isnegative),'red':thirdSGListSum.result | isnegative}">{{thirdSGListSum.result | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-footer>
<ion-content *ngIf="typeData.report && selectPlatformID=='all'" style="--background: #efefef;">
  <ion-grid class="report-list">
    <ion-row>
      <ion-col size="3">日期</ion-col>
      <ion-col size="3">游戏平台</ion-col>
      <ion-col size="3">下注金额</ion-col>
      <ion-col size="3">盈亏</ion-col>
    </ion-row>
    <ion-row *ngFor="let item of allReportList" (click)="toReportSeparatelist(item)">
      <ion-col size="3">{{item.date}}</ion-col>
      <ion-col size="3">{{item.gametype}}</ion-col>
      <ion-col size="3">{{item.cashsum | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(item.resultsum | isnegative),'red':item.resultsum | isnegative}">{{item.resultsum | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-content>
<ion-footer *ngIf="typeData.report  && selectPlatformID=='all'">
  <ion-grid class="report-total">
    <ion-row>
      <ion-col size="3">总计</ion-col>
      <ion-col size="3">--</ion-col>
      <ion-col size="3">{{allReportListSum.cash | decimal}}</ion-col>
      <ion-col size="3" [ngClass]="{'gree':!(allReportListSum.result | isnegative),'red':allReportListSum.result | isnegative}">{{allReportListSum.result | decimal}}</ion-col>
    </ion-row>
  </ion-grid>
</ion-footer>
<!-- 未结明细 -->
<ion-header *ngIf="typeData.unsettlement"  class="nav-header">
  <ion-toolbar>
    <ion-buttons slot="start" *ngIf="showBack">
        <ion-button (click)="backLotter()">
          <ion-icon class="md-arrow-back"  ios="md-arrow-back"></ion-icon>
        </ion-button>
      </ion-buttons>
    <ion-title>未结明细</ion-title>
  </ion-toolbar>
</ion-header>
<ion-header *ngIf="typeData.unsettlement">
  <ion-grid class="todayfinish-header">
    <ion-row>
      <ion-col size="3">
        注单号
      </ion-col>
      <ion-col size="3">
        类型
      </ion-col>
      <ion-col size="2">
        玩法
      </ion-col>
      <ion-col size="2">
        下注
      </ion-col>
      <ion-col size="2">
        可赢
      </ion-col>
    </ion-row>
  </ion-grid>
</ion-header>
<ion-content *ngIf="typeData.unsettlement">
  <ion-refresher slot="fixed" pullFactor="0.5" pullMin="100" pullMax="200" (ionRefresh)="doRefresh($event,0)">
    <ion-refresher-content></ion-refresher-content>
  </ion-refresher>
  <ion-grid class="todayfinish-list">
    <ion-row *ngFor="let item of openList">
      <ion-col size="3">
        <p text-center>  
          <ion-text class="text-blue">{{item.show_id | ordernodeal:((item.created | datestr) | substr:'[2]')}}</ion-text>
        </p>
        <p text-center>
          <ion-text>{{item.created | datestr}}</ion-text>
        </p>
        <p text-center>
          <ion-text>{{item.created | datestr:'t'}}</ion-text>
        </p>
      </ion-col>
      <ion-col size="3">
        <p text-center>
          <ion-text>{{item.toplotname}}</ion-text>
        </p>
        <p text-center>
          <ion-text class="text-blue">第{{item.cycleid}}期</ion-text>
        </p>
        <p text-center>
          <ion-text class="text-blue">盘口{{item.region}}</ion-text>
        </p>
      </ion-col>
      <ion-col size="2">
        <p text-center>
          <ion-text class="text-blue"><span *ngIf="!(item.lotname | empty)">{{item.lotname}}/</span> <span
              [innerHtml]="item.depiction | html"></span></ion-text>
        </p>
        <p text-center>
          <ion-text><span class="text-blue">@</span><span class="text-red">{{item.rate}}</span></ion-text>
        </p>
      </ion-col>
      <ion-col size="2">
        <p text-center>
          <ion-text>{{item.cash | decimal}}</ion-text>
        </p>
      </ion-col>
      <ion-col size="2">
        <p text-center>
          <ion-text [ngClass]="{'gree':!(item.result2 | isnegative),'red':item.result2 | isnegative}">{{item.result2 | decimal}}</ion-text>
        </p>
      </ion-col>
    </ion-row>
  </ion-grid>
  <ion-infinite-scroll threshold="100px" (ionInfinite)="loadMoreData($event,0)">
    <ion-infinite-scroll-content loadingSpinner="bubbles" loadingText="加载更多">
    </ion-infinite-scroll-content>
  </ion-infinite-scroll>
</ion-content>
<ion-footer *ngIf="typeData.unsettlement">
  <ion-grid class="total-grid">
    <ion-row>
      <ion-col size="2">
        <div>
          <p>注数</p>
          <p style="color: #1749af;">{{sum.cnt}}</p>
        </div>
      </ion-col>
      <ion-col size="5">
        <div>
          <p>下注金额(总计)</p>
          <p>{{sum.cash | decimal }}</p>
        </div>
      </ion-col>
      <ion-col size="5">
        <div>
          <p>可赢(总计)</p>
          <p [ngClass]="{'gree':!(sum.result | isnegative),'red':sum.result | isnegative}">{{sum.result | decimal }}</p>
        </div>
      </ion-col>
    </ion-row>
  </ion-grid>
  <ion-grid class="unset-footer-grid">
    <ion-row>
      <ion-col size="6">
        <ion-button color="primary01" expand="full" (click)="toSettlement()">
          <ion-icon slot="start" style="font-size: 38px; padding-right: 5px;" class="iconfont ion-ios-yijiesuan">
          </ion-icon>今日已结
        </ion-button>
      </ion-col>
      <ion-col size="6">
        <ion-button color="reportbtn" expand="full" (click)="toReport()">
          <ion-icon slot="start" style="font-size: 30px; padding-right: 5px;" class="iconfont ion-ios-baobiaochaxun">
          </ion-icon>报表查询
        </ion-button>
      </ion-col>
    </ion-row>
  </ion-grid>
</ion-footer>
<!-- 今日已结 -->
<ion-header *ngIf="typeData.settlement"  class="nav-header">
  <ion-toolbar>
    <ion-buttons slot="start">
      <ion-button (click)="toUnSettlement()">
        <ion-icon class="md-arrow-back"  ios="md-arrow-back"></ion-icon>
      </ion-button>
    </ion-buttons>
    <ion-title>今日已结</ion-title>
  </ion-toolbar>
</ion-header>
<ion-header *ngIf="typeData.settlement">
  <ion-grid class="todayfinish-header">
    <ion-row>
      <ion-col size="3">
        注单号
      </ion-col>
      <ion-col size="3">
        类型
      </ion-col>
      <ion-col size="2">
        玩法
      </ion-col>
      <ion-col size="2">
        下注
      </ion-col>
      <ion-col size="2">
        输赢
      </ion-col>
    </ion-row>
  </ion-grid>
</ion-header>
<ion-content *ngIf="typeData.settlement">
  <ion-refresher slot="fixed" pullFactor="0.5" pullMin="100" pullMax="200" (ionRefresh)="doRefresh($event,1)">
    <ion-refresher-content></ion-refresher-content>
  </ion-refresher>
  <ion-grid class="todayfinish-list">
    <ion-row *ngFor="let item of closedList">
      <ion-col size="3">
        <p text-center>
          <ion-text class="text-blue">{{item.show_id | ordernodeal:dealDate}}</ion-text>
        </p>
        <p text-center>
          <ion-text>{{item.created | datestr}}</ion-text>
        </p>
        <p text-center>
          <ion-text>{{item.created | datestr:'t'}}</ion-text>
        </p>
      </ion-col>
      <ion-col size="3">
        <p text-center>
          <ion-text>{{item.toplotname}}</ion-text>
        </p>
        <p text-center>
          <ion-text class="text-blue">第{{item.cycleid}}期</ion-text>
        </p>
        <p text-center>
          <ion-text class="text-blue">盘口{{item.region}}</ion-text>
        </p>
      </ion-col>
      <ion-col size="2">
        <p text-center>
          <ion-text class="text-blue"><span *ngIf="!(item.lotname | empty)">{{item.lotname}}/</span> <span
              [innerHtml]="item.depiction | html"></span></ion-text>
        </p>
        <p text-center>
          <ion-text><span class="text-blue">@</span><span class="text-red">{{item.rate}}</span></ion-text>
        </p>
      </ion-col>
      <ion-col size="2">
        <p text-center>
          <ion-text>{{item.cash | decimal}}</ion-text>
        </p>
      </ion-col>
      <ion-col size="2">
        <p text-center>
          <ion-text [ngClass]="{'gree':!(item.result2 | isnegative),'red':item.result2 | isnegative}">
            {{item.result2 | decimal}}</ion-text>
        </p>
      </ion-col>
    </ion-row>
  </ion-grid>
  <ion-infinite-scroll threshold="100px" (ionInfinite)="loadMoreData($event,1)">
    <ion-infinite-scroll-content loadingSpinner="bubbles" loadingText="加载更多">
    </ion-infinite-scroll-content>
  </ion-infinite-scroll>
</ion-content>
<ion-footer *ngIf="typeData.settlement">
  <ion-grid class="total-grid">
    <ion-row>
      <ion-col size="2">
        <div>
          <p>注数</p>
          <p style="color: #1749af;">{{sum.cnt}}</p>
        </div>
      </ion-col>
      <ion-col size="5">
        <div>
          <p>下注金额(总计)</p>
          <p>{{sum.cash | decimal }}</p>
        </div>
      </ion-col>
      <ion-col size="5">
        <div>
          <p>结果(总计)</p>
          <p [ngClass]="{'gree':!(sum.result | isnegative),'red':sum.result | isnegative}">{{sum.result | decimal }}</p>
        </div>
      </ion-col>
    </ion-row>
  </ion-grid>
</ion-footer>